package com.example.wan1.view.system.knowledge;

import com.example.wan1.R;
import com.example.wan1.adapter.KnowledgeAdapter;
import com.example.wan1.adapter.PerKnowledgeAdapter;
import com.example.wan1.base.adapter.SubPagerAdapter;
import com.example.wan1.di.ano.ActivityScope;
import com.example.wan1.di.ano.FragmentScope;
import com.example.wan1.model.ArticleBean;
import com.example.wan1.model.KnowledgeBean;
import com.example.wan1.view.system.knowledge.level2.KnowledgeLevelActivity;
import com.example.wan1.view.system.knowledge.level2.PerKnowledgeContract;
import com.example.wan1.view.system.knowledge.level2.PerKnowledgeFragment;

import java.util.ArrayList;
import java.util.List;

import androidx.fragment.app.Fragment;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;

import static androidx.fragment.app.FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT;

/***
 * @Author: zxd
 * @CreateDate: 2020/8/26 16:10
 * @Description:
 */
@Module
public abstract class KnowledgeModule {

    @Binds
    abstract KnowledgeContract.View knowledgeView(KnowledgeSystemFragment knowledgeSystemFragment);

    @FragmentScope
    @Provides
    static KnowledgeAdapter provideKnowledgeAdapter(List<KnowledgeBean> list) {
        return new KnowledgeAdapter(R.layout.knowledge_rv_item, list);
    }

    @FragmentScope
    @Provides
    static List<KnowledgeBean> provideKnowledgeList() {
        return new ArrayList<>();
    }

    //第二层的activity
    @ActivityScope
    @Provides
    static SubPagerAdapter provideAdapter(KnowledgeLevelActivity system) {
        return new SubPagerAdapter(system.getSupportFragmentManager(),
                BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
    }

    @ActivityScope
    @Provides
    static List<String> provideTitleList() {
        return new ArrayList<>();
    }

    @ActivityScope
    @Provides
    static List<Fragment> provideFragmentList() {
        return new ArrayList<>();
    }

    @ActivityScope
    @Provides
    static List<Integer> provideIdsList() {
        return new ArrayList<>();
    }

    @Binds
    abstract PerKnowledgeContract.View perView(PerKnowledgeFragment perKnowledgeFragment);

    @FragmentScope
    @Provides
    static PerKnowledgeAdapter providePerKnowledgeAdapter(List<ArticleBean> list) {
        return new PerKnowledgeAdapter(R.layout.per_knowledge_rv_item, list);
    }

    @FragmentScope
    @Provides
    static List<ArticleBean> provideArticleList() {
        return new ArrayList<>();
    }

}
